<template>
    <div class="school">
        <h2>学生名称:{{ name }}</h2>
        <h2>学生名称:{{ address }}</h2>
        <button @click="sendSchoolName">把学生给父组件</button>
    </div>
</template>

<script>
import pubsub from "pubsub-js"

export default {
    name: "Student",
    data() {
        return {
            name:"冯镠霖Student",
            address: "中国Student"
        }
    },
    methods: {
        sendSchoolName() {
            pubsub.publish("hello", 666)
        }
    }
}
</script>

<style scoped>
.school {
    background-color: aquamarine;
}
</style>